package com.ibm.cloud.banking.sample.service.impl;

import com.ibm.cloud.banking.annotation.PBS;
import com.ibm.cloud.invoker.PbsService;

import lombok.extern.slf4j.Slf4j;

/**
 * 测试生成PBS SAGA定义
 *
 * @author HanDong
 * @date 2022/7/25
 */

@PBS(servNo = "PBS000003")
@Slf4j
public class Pbs03Service<PARAM_TYPE, RETURN_TYPE> implements PbsService<PARAM_TYPE, RETURN_TYPE> {

    @Override
    public RETURN_TYPE doService(PARAM_TYPE data) {
        log.info("正向交易PBS000003{}", data);
        if (true) {
            throw new RuntimeException("Test Error");
        }
        return (RETURN_TYPE) "123";
    }

    @Override
    public void compensate(PARAM_TYPE data) {
        log.info("补偿交易{}", data);
    }
}
